#ifndef CLICK_QOSMANAGER_HH
#define CLICK_QOSMANAGER_HH

#include <click/element.hh>
#include <clicknet/ether.h>
#include <click/vector.cc>
#include <click/timer.hh>

#include "rsvpheader.hh"
#include "resvdata.hh"
#include "pathdata.hh"
#include "teardowndata.hh"

CLICK_DECLS

class QosManager : public Element {

public:
	QosManager();
	~QosManager();
	
	const char *class_name() const { return "QosManager"; }
	const char *port_count() const { return "1/2"; }
	const char *processing() const { return PUSH; }
	
	int configure(Vector<String>& conf, ErrorHandler* errh);
	void push(int port, Packet* p);
	
	void add_handlers();
	
private:
	static int status;
	
	in_addr fAddress;
	
	Timer* pathTimer;
	struct TimerData {
		QosManager* qosManager;
	};
	static void handlePathRun(Timer*, void*);
	
	WritablePacket* makePathMessage();
	WritablePacket* makeResvMessage(in_addr);
	WritablePacket* makeTeardownMessage();
	
	static int resume(const String &conf, Element *e, void * thunk, ErrorHandler * errh);
	static int stop(const String &conf, Element *e, void * thunk, ErrorHandler * errh);
	static int teardown(const String &conf, Element *e, void * thunk, ErrorHandler * errh);

};

CLICK_ENDDECLS
#endif
